var a = require("../../../wxParse/wxParse.js"), t = require("../../../utils/api.js");

getApp();

Page({
    data: {
        article: "",
        show: !1,
        all: !1,
        integral: 0
    },
    onLoad: function(o) {
        var e = this, i = o.id;
        t.getFraction_info({
            id: i
        }).then(function(t) {
            if (console.log(t), 0 == t.data.status) {
                a.wxParse("article", "html", t.data.data.g_info, e, 5);
                var o = getCurrentPages(), i = o[o.length - 2].data;
                if (parseFloat(i.info.member.integral) >= parseFloat(t.data.data.integral) && parseFloat(t.data.data.stock) > 0) r = !1; else var r = !0;
                e.setData({
                    info: t.data.data,
                    all: r
                });
            }
        }), wx.setNavigationBarColor({
            frontColor: wx.getStorageSync("basic").topcolor,
            backgroundColor: wx.getStorageSync("basic").topbg
        });
    },
    showAttrPicker: function(a) {
        this.setData({
            show: !0
        });
    },
    exchange: function(a) {
        var t = this;
        console.log(t.data.info);
        var o = t.data.info;
        if (o.stock <= 0) return wx.showLoading({
            title: "已售罄"
        }), setTimeout(function() {
            wx.hideLoading();
        }, 2e3), !1;
        wx.navigateTo({
            url: "/pages/integralMall/orderSubmit/index?id=" + o.g_id
        });
    },
    onCloseButton: function(a) {
        this.setData({
            show: !1
        });
    }
});